package com.geen.tuoke.ui.activity

import android.os.Bundle
import com.geen.tuoke.R
import com.geen.tuoke.base.BaseActivity
import com.geen.tuoke.base.EmptyViewModel
import com.geen.tuoke.databinding.ActivityWebBinding
import com.geen.tuoke.utils.IntentConstants
import com.geen.tuoke.utils.ext.initClose
import kotlinx.android.synthetic.main.include_toolbar.*

/**
 * @Author LuoJi
 * @Date 2021/12/30-14:15
 * @Desc
 */
class WebActivity : BaseActivity<EmptyViewModel,ActivityWebBinding>() {

    private var toolbarTitle:String? = null
    private var h5Url : String? = null

    override fun getLayoutId(): Int {
        return R.layout.activity_web
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        with(mBinding){
            lifecycleOwner = this@WebActivity
        }
        toolbarTitle = intent?.extras?.getString(IntentConstants.INTENT_TITLE,"")
        h5Url = intent?.extras?.getString(IntentConstants.INTENT_URL)

        toolbar.initClose(toolbarTitle) {
            finish()
        }
        h5Url?.let {
            mBinding.mWebView.loadUrl(it)
        }
    }
}